<template>
  <div class="author-page-relation">
    <block>
      <relation-map :name="name" :level="level"></relation-map>
      <div class="operations">
        <button @click="upLevel">More</button>
        <button @click="downLevel">Less</button>
      </div>
    </block>
    <block>
      <prediction-map :name="name"></prediction-map>
    </block>
  </div>
</template>

<script>
import Block from '@/components/Block/AuthorPageBlock';
import RelationMap from '@/components/Chart/RelationMap';
import PredictionMap from '@/components/Chart/PredictionMap';
export default {
  name: "AuthorPageRelation",
  props: {
    msg: {
      type: Object,
      default: () => new Object()
    }
  },
  data() {
    return {
      level: 2
    };
  },
  computed: {
    name() {
      return this.msg.name[0] ?? 'Loading';
    }
  },
  mounted() {

  },
  watch: {

  },
  methods: {
    upLevel() {
      if (this.level < 5) {
        this.level ++;
      }
    },
    downLevel() {
      if (this.level > 1) {
        this.level --;
      }
    }
  },
  components: {
    RelationMap,
    Block,
    PredictionMap
  },
};
</script>

<style scoped lang="scss">
.author-page-relation {
  @media screen and (max-width: 500px){
    display: none;
  }

  > * {
    margin-bottom: 20px;
  }

  .operations {
    display: flex;
    justify-content: flex-end;
    padding-right: 30px;
    padding-bottom: 20px;

    >:hover {
      cursor: pointer;
    }

    >:first-child{
      background-color: #4CAF50; /* Green */
      border: none;
      color: white;
      padding: 15px 32px;
      text-align: center;
      text-decoration: none;
      display: inline-block;
      font-size: 16px;
      margin-right: 20px;
    }

    >:nth-child(2n){
      background-color: #008CBA; /* Green */
      border: none;
      color: white;
      padding: 15px 32px;
      text-align: center;
      text-decoration: none;
      display: inline-block;
      font-size: 16px;
    }

    
  }
}
</style>
